package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.core.integration.EduBdDataIntegration;
import com.jwsoft.manager.common.vo.eduBdSbjzz.EduBdSbjzzVO;
import com.jwsoft.manager.common.vo.eduBdSbjzz.EduBdSbjzzKeyVO;
import com.jwsoft.manager.common.vo.eduBdSbjzz.EduBdSbjzzQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 数据比对信息表网关
 *
 * @author zhiyuan
 * @since 2023-09-26
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "数据比对信息表", description = "数据比对信息表")
public class EduBdDataController {

    @Autowired
    public EduBdDataIntegration EduBdDataIntegration;

    @Operation(summary = "数据比对信息表分页查询",description = "数据比对信息表分页查询")
    @PostMapping(value = "/eduBdData0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduBdSbjzzVO>> getList(@RequestBody @Validated EduBdSbjzzQueryVO vo) {
        return AppResponse.successData(EduBdDataIntegration.getList(vo));
    }

    @Operation(summary = "数据比对信息表根据主键查询详情",description = "数据比对信息表根据主键查询详情")
    @PostMapping(value = "/eduBdData0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBdSbjzzVO> getById(@RequestBody @Validated EduBdSbjzzKeyVO vo) {
        return AppResponse.successData(EduBdDataIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据比对信息表新增",description = "数据比对信息表新增")
    @PostMapping(value = "/eduBdData0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBdSbjzzVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduBdSbjzzVO vo) {
        return AppResponse.successData(EduBdDataIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据比对信息表修改",description = "数据比对信息表修改")
    @PostMapping(value = "/eduBdData0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBdSbjzzVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduBdSbjzzVO vo) {
        return AppResponse.successData(EduBdDataIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据比对信息表删除",description = "数据比对信息表删除")
    @PostMapping(value = "/eduBdData0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduBdSbjzzKeyVO vo) {
        EduBdDataIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @NoSignCrypto
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据比对",description = "数据比对")
    @PostMapping(value = "/eduBdData0007", produces = "application/json;charset=UTF-8")
    public AppResponse dataComparison(@RequestBody @Validated EduBdSbjzzQueryVO vo) {
        EduBdDataIntegration.dataComparison(vo);
        return AppResponse.successMsg("数据比对完成！");
    }
}
